<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<div class="span12 box-content">
	<form class="form-inline well" id="projectFilter_form">
		<div class="controls controls-row">
			<label>学院:</label>
			<select class="span2" style="display:inline;" name="college">
			  <c:forEach items="${colleges }" var="c">
			 	 <option value="${c.id }" ${c.id==clgId?"selected='selected'":""}>${c.name }</option>
			  </c:forEach>
			</select>
			<button type="button" id="projectFilter_go">筛选</button>
		</div>
	</form>
	<div class="span12">共有${projectCount}条数据,${totalPage }页</div>
	<table class="table table-striped table-bordered" id="project_list_table">
		<thead>
		 <tr role="row">
		 	<th>题目名称</th>
		 	<th>题目描述</th>
		 	<th>发布时间</th>
		 	<th>适用专业方向</th>
		 	<th>指导教师</th>
		 	<th>评阅人</th>
		 	<th>选定学生</th>
		 	<th>状态</th>
		 	<th>更多</th>
		 </tr>
		</thead>   
		<tbody>
		<c:forEach items="${project }" var="p">
			<tr>
				<td>${p.name }</td>
				<td><button type="button" class="btn btn-info project_desc_show"  data-target="#project_description_box" data-toggle="modal">点击查看<div style="display: none" class="description_div">${p.description }</div></button> </td>
				<td><fmt:formatDate value="${p.publish_date }" pattern="yyyy-MM-dd HH:mm"/> </td>
				<td><c:forEach items="${p.profs }" var="pp">${pp.branch.name } </c:forEach></td>
				<td>${p.teacher.name }</td>
				<td>${p.shengyue_teacher.name}</td>
				<td> <c:if test="${empty  p.student.name}">无</c:if> ${p.student.name}</td>
				<td>
					<c:if test="${p.status=='NOT_AUTH'}">还未审核</c:if>
					<c:if test="${p.status=='PASSED'}">已通过审核</c:if>
					<c:if test="${p.status=='AUTHERIC_FAILED'}">未通过审核</c:if>
				</td>
				<c:if test="${!user.superAdmin &&user.collegeId!=p.teacher.department.college.id}">
					<c:set var="editDisabled" value="disabled"/>
				</c:if>
				<td>
					<button type="button" class="btn btn-info project_edit" data-projectId="${p.id }"  ${editDisabled }>
						<i class="icon-edit icon-white"></i>  
						编辑
					</button>
					<button type="button" class="btn btn-danger project_delete"  data-target="#project_delete_box" data-toggle="modal" data-projectId="${p.id }" ${editDisabled }>
						<i class="icon-trash icon-white"></i>  
						删除
					</button>
					<c:if test="${editDisabled!=null }">
						无权操作
					</c:if>
				</td>
			</tr> 
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination  pagination-centered"
			data-totalPage="${totalPage }" 
			data-currentPage="${page }" 
			data-url="<%=basePath%>admin/project/showProjectList/${clgId }/{page}"
			style="display:none">
	</div>
	<div class="well">
		<a class="btn btn-primary" href="<%=basePath %>admin/project/showInsertProject">
			<i class=" icon-plus icon-white"></i>
			新建一个毕业设计题目
		</a>
		<button type="button" class="btn btn-primary" id="project_add_excel" data-target="#project_add_excel_box" data-toggle="modal" >
			<i class=" icon-plus icon-white"></i>  
			从excel导入题目列表
		</button>
		<a href="<%=basePath %>admin/project/projectList.xls" class="btn btn-primary"  >
			<i class="  icon-download-alt icon-white"></i>  
			导出题目列表(Excel2003格式)
		</a>		
		<a href="<%=basePath %>admin/project/projectList.xlsx" class="btn btn-primary" >
			<i class="  icon-download-alt icon-white"></i>  
			导出题目列表(Excel2007格式)
		</a>
		<br/>
		<br/>
		<p>导入说明:支持xls(Excel 2003默认格式)和xlsx(Excel 2007之后)格式的文件.<a href="<%=basePath %>resource/projectImportSample.zip">点击这里下载示例文件</a></p>
	</div>
</div>
<!-- 显示描述 开始-->
<div class="modal hide fade" id="project_description_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>题目描述</h3>
	</div>
	<div class="modal-body">
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">关闭</a>
	</div>
</div>
<!-- 显示描述 结束 -->
<!-- 删除确认 开始-->
<div class="modal hide fade" id="project_delete_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>删除题目</h3>
	</div>
	<div class="modal-body">
		<input type="hidden" name="projectId"/>
            确认删除?删除动作不可撤销!
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-danger" id="project_delete_box_delete">删除</a>
	</div>
</div>
<!-- 删除确认 结束 -->
<!-- 批量导入 开始-->
<div class="modal hide fade" id="project_add_excel_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>批量导入题目</h3>
	</div>
	<div class="modal-body">
		<div id="project_add_excel_box_alert_container" ></div><br/>
		<span class="btn btn-success fileinput-button" id="project_add_excel_box_file">
			<span>选择文件</span>
			<input type="file" name="excel"  >
		</span>
		<span id="project_add_excel_box_file_name">未选择</span>
		<div class="progress progress-info progress-striped" style="margin-top: 3%;display:none" id="project_add_excel_box_progress">
				<div class="bar" style="width: 0%" ></div>
		</div>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="project_add_excel_box_confirm">确定</a>
	</div>
</div>
<!-- 批量导入 结束 -->